<?php

namespace app\models;

use Yii;

/**
 * This is the model class for table "repair_evaluate".
 *
 * @property int $id
 * @property int $task_id 任务id
 * @property int $repair_id 维修队id
 * @property int $user_id 用户id
 * @property int $star_finsh_time 完成时间评分
 * @property int $star_finsh_quality 完成质量评分
 * @property int $star_service 服务态度评分
 * @property string $content 评价内容
 * @property int $status 状态
 * @property int $created_at 创建时间
 */
class RepairEvaluate extends Base
{
    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'repair_evaluate';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['task_id', 'repair_id', 'user_id', 'star_finsh_time', 'star_finsh_quality', 'star_service', 'status', 'created_at'], 'integer'],
            [['content'], 'string'],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'task_id' => 'Task ID',
            'repair_id' => 'Repair ID',
            'user_id' => 'User ID',
            'star_finsh_time' => 'Star Finsh Time',
            'star_finsh_quality' => 'Star Finsh Quality',
            'star_service' => 'Star Service',
            'content' => 'Content',
            'status' => 'Status',
            'created_at' => 'Created At',
        ];
    }

    public function getRepair(){
        return $this->hasOne(Repair::class, ['id' => 'repair_id']);
    }

    public function getUser(){
        return $this->hasOne(User::class, ['id' => 'user_id']);
    }

    public function getTask(){
        return $this->hasOne(Task::class, ['id' => 'task_id']);
    }
}
